package calculator.operator.sp;


import calculator.operator.Operator;
import calculator.operator.Priority;

import java.util.Stack;

public class AbsOperator implements Operator {

    public double doCal(double num){
        return Math.abs(num);
    }

    @Override
    public double doCal(Stack<Double> stack) {
        return doCal(stack.pop());
    }

    @Override
    public int getPriority() {
        return Priority.PRIORITY_HIGHEST - 1;
    }

    @Override
    public boolean support(char c) {
        return c == '|';
    }
}
